import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    // @ = src这层路由
    component: () => import('@/views/login')
  },
  {
    path: '/',
    component: () => import('@/views/layout'),
    children: [
      { path: '', name: 'home', component: () => import('@/views/home') },
      { path: '/qa', name: 'qa', component: () => import('@/views/qa') },
      { path: '/video', name: 'shipin', component: () => import('@/views/video') },
      { path: '/profile', name: 'profile', component: () => import('@/views/profile') }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/search')
  },
  // 文章详情
  {
    path: '/article/detail/:articleId',
    name: 'articleDetail',
    component: () => import('@/views/articleDetail'),
    props: true
  },
  {
    path: '/user',
    component: () => import('@/views/user')
  }
]

const router = new VueRouter({
  routes
})

export default router
